$(function(){
    var btn = $('.msgYzm');

    /**
     * 短信发送验证码仿刷新
     */
    if($.cookie("captcha")){
        btn.attr('data-value',0);
        var count = $.cookie("captcha");
        sendMsgCountDown(btn,count);
        btn.addClass('gray9');
    }else{
        btn.attr('data-value',1);
    }

    /**
     * 短信发送验证码
     */
    btn.click(function(){
        var _this = $(this);
        var val=_this.attr('data-value');
        var mobileObj=$('#mobile');
        var mobile=mobileObj.val();

        if(val==1){
            if(!checkMobile(mobile)){
                registerBoxMsg(mobileObj,'手机号错误');
                return;
            }

            clerBoxMsg(mobileObj);
            sendSms(mobile,1);

            _this.addClass('gray9');
            var count = 60;
            _this.attr('data-value',0);
            sendMsgCountDown(_this,count);
        }else{
            _this.removeClass('gray9');
        }
    });
});